/**
 * Created by Void on 2017/7/21.
 */

import {Directive, ElementRef} from '@angular/core';


@Directive({
    selector: '[imgloading]'
})
export class ImgLoadingDirective {
    constructor(private el:ElementRef) {
    }

    ngAfterViewInit() {
        let ele = this.el.nativeElement;
        let parentNode = ele.parentElement;

        let elWidth = this.el.nativeElement.clientWidth;
        let elHeight = this.el.nativeElement.style.height;
        if (elHeight === ''){
            this.el.nativeElement.style.height = elWidth + 'px';
        }

        // TODO 因为技术问题(操作dom添加ion-spinner 相应的SVN图没加载上) 暂时不添加图片加载中的loading
        // let animate = '<ion-spinner name="ios" style="position: absolute;top: 0;bottom: 0;left: 0;right: 0;margin: auto">';
    }
}